#include "stdafx.h"
#include "Utils.h"

Utils::Utils(void)
{
}

Utils::~Utils(void)
{
}

void Utils::styleToStrings(int style, std::vector<std::string>& strs)
{
	if(style &  CS_BYTEALIGNCLIENT )
		strs.push_back("CS_BYTEALIGNCLIENT");

	if(style &  CS_BYTEALIGNWINDOW )
		strs.push_back( "CS_BYTEALIGNWINDOW");

	if(style &  CS_CLASSDC )
		strs.push_back( "CS_CLASSDC");

	if(style &  CS_DBLCLKS )
		strs.push_back( "CS_DBLCLKS");

	// Was CS_GLOBALCLASS (has same value)
	if(style & CS_GLOBALCLASS)  
		strs.push_back( "CS_GLOBALCLASS");//PUBLICCLASS )

	if(style &  CS_HREDRAW )
		strs.push_back( "CS_HREDRAW");

	if(style &  CS_NOCLOSE )
		strs.push_back( "CS_NOCLOSE");

	if(style &  CS_OWNDC )
		strs.push_back( "CS_OWNDC");

	if(style &  CS_PARENTDC )
		strs.push_back( "CS_PARENTDC");

	if(style &  CS_SAVEBITS )
		strs.push_back( "CS_SAVEBITS");

	if(style &  CS_VREDRAW )
		strs.push_back( "CS_VREDRAW");
}

int Utils::stringsToStyle(const std::vector<std::string>& strs)
{
	int style = 0;
	for(size_t i = 0; i< strs.size(); ++i)
	{
		if(strs[i] == "CS_BYTEALIGNCLIENT" )
			style |= CS_BYTEALIGNCLIENT;
		else if(strs[i] == "CS_BYTEALIGNWINDOW" )
			style |= CS_BYTEALIGNWINDOW;
		else if(strs[i] == "CS_CLASSDC" )
			style |= CS_CLASSDC;
		else if(strs[i] == "CS_DBLCLKS" )
			style |= CS_DBLCLKS;
		else if(strs[i] == "CS_GLOBALCLASS" )
			style |= CS_GLOBALCLASS;
		else if(strs[i] == "CS_HREDRAW" )
			style |= CS_HREDRAW;
		else if(strs[i] == "CS_NOCLOSE" )
			style |= CS_NOCLOSE;
		else if(strs[i] == "CS_OWNDC" )
			style |= CS_OWNDC;
		else if(strs[i] == "CS_PARENTDC" )
			style |= CS_PARENTDC;
		else if(strs[i] == "CS_SAVEBITS" )
			style |= CS_SAVEBITS;
		else if(strs[i] == "CS_VREDRAW" )
			style |= CS_VREDRAW;
	}
}